<%@ Page Title="Clients" Language="C#" MasterPageFile="~/Backoffice/BackOffice.Master"
    AutoEventWireup="true" CodeBehind="Clients.aspx.cs" Inherits="StrongerOrg.Backoffice.Organisations"
    Debug="true" %>

<%@ MasterType VirtualPath="~/Backoffice/BackOffice.Master" %>
<%@ Register Src="~/Backoffice/UserControls/OrganisationInfo.ascx" TagName="OrganisationInfo"
    TagPrefix="uc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Id,Name"
        DataSourceID="SqlDataSource1" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
        OnRowCreated="GridView1_RowCreated">
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <asp:TemplateField HeaderText="Users" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" NavigateUrl="~/Backoffice/Administrator/ManageUsers.aspx"
                        ImageUrl="~/Images/Icons/group.gif" runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:BoundField DataField="WebSite" HeaderText="Web Site" SortExpression="WebSite" />
            <asp:CheckBoxField DataField="Active" HeaderText="Active" SortExpression="Active" />
        </Columns>
        <EmptyDataTemplate>
            No Records found
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationConnectionString %>"
        SelectCommand="GetClients" SelectCommandType="StoredProcedure" CancelSelectOnNullParameter="False"
        DeleteCommand="DELETE FROM [Clients] WHERE [Id] = @Id" InsertCommand="INSERT INTO Clients(Name, ContactPerson, ShippingAddress, BillingAddress, WebSite) VALUES (@Name, @ContactPerson, @ShippingAddress, @BillingAddress, @WebSite)"
        OnSelecting="SqlDataSource1_Selecting">
        <SelectParameters>
            <asp:QueryStringParameter Name="Id" QueryStringField="OrgId" Type="String" ConvertEmptyStringToNull="true" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter Name="Id" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Name" />
            <asp:Parameter Name="ContactPerson" />
            <asp:Parameter Name="ShippingAddress" />
            <asp:Parameter Name="BillingAddress" />
            <asp:Parameter Name="WebSite" />
        </InsertParameters>
    </asp:SqlDataSource>
    <br />
    <br />
    <uc1:OrganisationInfo ID="OrganisationInfo1" runat="server" />
</asp:Content>
